import Vue from 'vue';
import Router from 'vue-router';
import MusicList from '@/components/MusicList';
import MusicInfo from '@/components/MusicInfo';
import MusicLyric from '@/components/MusicLyric';
import Search from '@/components/Search';
import Login from '@/components/Login';
import Signup from '@/components/Signup';
import MyList from '@/components/MyList';
import page404 from '@/components/404';

Vue.use(Router);

export default new Router({
  // mode: 'history',
  routes: [
    {
      path: '/',
      name: 'MusicPlayer',
    },
    {
      path: '/musiclist',
      name: 'MusicListNow',
      component: MusicList,
    },
    {
      path: '/musiclist/:id',
      name: 'MusicList',
      component: MusicList,
    },
    {
      path: '/musicinfo',
      name: 'MusicInfoNow',
      component: MusicInfo,
    },
    {
      path: '/musicinfo/:type/:id',
      name: 'MusicInfo',
      component: MusicInfo,
    },
    {
      path: '/musiclyric',
      name: 'MusicLyric',
      component: MusicLyric,
    },
    {
      path: '/search',
      redirect: '/',
    },
    {
      path: '/search/:keyword',
      name: 'Search',
      component: Search,
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
    },
    {
      path: '/signup',
      name: 'Signup',
      component: Signup,
    },
    {
      path: '/mylist',
      name: 'MyLish',
      component: MyList,
    },
    {
      path: '/*',
      component: page404,
    },
  ],
});
